from tkinter.constants import CASCADE

from django.db import models

from utils.BaseModel import BaseModel
# Create your models here.
class NavModel(BaseModel):
    navname=models.CharField(max_length=50,verbose_name="导航名称")
    position=models.BooleanField(default=True,verbose_name="导航位置")
    link=models.CharField(max_length=100,verbose_name="跳转连接",blank=True,null=True)
    class Meta:
        db_table="fgnav"
    def __str__(self):
        return self.navname


class BannerModel(BaseModel):
    imgurl=models.CharField(max_length=50,verbose_name="图片路径")
    link=models.CharField(max_length=200,verbose_name="图片路径",blank=True,null=True)
    name=models.CharField(max_length=20,verbose_name="图片名称")
    class Meta:
        db_table="fgbanner"
    def __str__(self):
        return self.name

class cateModel(BaseModel):
    catename=models.CharField(max_length=50,verbose_name="分类名称")
    parent=models.ForeignKey("self",on_delete=models.CASCADE,null=True,blank=True,related_name='children')
    is_del=models.BooleanField(default=0)
    is_home=models.BooleanField(default=True,verbose_name="是否展示首页")
    is_hot=models.BooleanField(default=False,verbose_name="是否热门")
    is_good=models.BooleanField(default=False,verbose_name="是否精品")
    class Meta:
        db_table="fgcate"
    def __str__(self):
        return self.catename
